// 方式1.通过相对路径
// import request from '../utils/request.js'
// 方式2.通过src的别名来(推荐)
// 标准写法
// import request from '@/utils/request.js'
// 熟悉的写法
import request from '@/utils/request.js'

export function login (data) {
  return request({
    url: '/v1_0/authorizations',
    method: 'post',
    data
  })
}

export function sendSms (mobile) {
  return request({
    url: '/v1_0/sms/codes/' + mobile,
    method: 'get'
  })
}

export function getUserInfo () {
  return request({
    url: '/v1_0/user',
    method: 'get'
  })
}

export function getUserChannels () {
  return request({
    url: '/v1_0/user/channels',
    method: 'get'
  })
}

export function deleteFollow (target) {
  return request({
    url: '/v1_0/user/followings/' + target,
    method: 'DELETE'
  })
}

export function addFollow (target) {
  return request({
    url: '/v1_0/user/followings',
    method: 'POST',
    data: {
      target
    }
  })
}

export function getUserProfile () {
  return request({
    url: '/v1_0/user/profile',
    method: 'GET'
  })
}

export function updateUserProfile (data) {
  return request({
    url: '/v1_0/user/profile',
    method: 'PATCH',
    data
  })
}

export function uploadPhoto (data) {
  return request({
    url: '/v1_0/user/photo',
    method: 'PATCH',
    data
  })
}
